<?php
/*
 * @Author: your name
 * @Date: 2020-12-07 11:09:15
 * @LastEditTime: 2020-12-07 13:31:28
 * @LastEditors: Please set LastEditors
 * @Description: wipf配置
 * @FilePath: /v3/application/common/wipf/WipfConfig.php
 */
namespace app\common\wipf;

use app\common\service\Base;
use app\common\service\IpsConfig;

class WipfConfig
{
    //wipf配置容器
    public $config_data = [];

    function __construct($host_id)
    {
        $IpsConfig = new IpsConfig();
        $this->config_data = $IpsConfig->findData(['host_id'=> $host_id]);
    }
    /**
     * @name: 客户端配置
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2020-12-07 11:11:19
     */
    public function clientConfig ($defaultProcess)
    {
        $return = [
            //wipf运行模式
            'WipfMode' => $this->config_data['type'] == 1 ? 'ips' : 'ids',//函谷盾模式
            //ips处理状态
            'IpsProcessStatus' => $this->config_data['status'] ? true : false,
            //ids 设备
            'IdsDevice' => $this->config_data['device_ip'],
            //ips设备
            'IpsDevice' => $this->config_data['protect_ip'],
            //ips黑名单
            'IpsBlackList' => $this->config_data['black'] ? true : false,
            //是否锁定防火墙
            'Lock' => $this->config_data['firewall'] ? true : false,
            //防火拒绝默认处理方式
            'Handle' => $defaultProcess
        ];

        return $return;
    }
}